import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'
import { contentPath } from "@/constant/system.js"
// 全局静态路由
export const routes = [
  {
    path: "/",
    name: "Layout",
    sort: 0,
    icon: "Layout",
    component: () => import("../views/layout/Layout.vue"),
    children: [
      {
        path: contentPath + "/home",
        name: "首页",
        sort: 0,
        icon: "DefineIconHomeSVGIcon",
        component: () => import("../views/HomeView.vue"),
      },
      {
        path: contentPath + "/empty",
        name: "空白组件页面",
        sort: 8,
        icon: "DefineIconLoginSVGIcon",
        component: () => import("../views/oss/empty.vue"),
      },
      {
        path: contentPath + "/system",
        name: "系统管理",
        icon: "DefineIconSettingSVGIcon",
        sort: 2,
        children: [
          {
            path: contentPath + "/dictionaryType",
            name: "字典管理",
            sort: 3,
            icon: "DefineIconDictionarySVGIcon",
            component: () => import("../views/system/dictionaryType"),
          },
          {
            path: contentPath + "/user",
            name: "用户管理",
            sort: 3,
            icon: "DefineIconUserSVGIcon",
            component: () => import("../views/system/user"),
          },
          {
            path: contentPath + "/role",
            name: "角色管理",
            sort: 4,
            icon: "DefineIconRoleSVGIcon",
            component: () => import("../views/system/role"),
          },
          {
            path: contentPath + "/menu",
            name: "菜单管理",
            sort: 5,
            icon: "DefineIconMenuSVGIcon",
            component: () => import("../views/system/menu"),
          },
          {
            path: contentPath + "/loginRecords",
            name: "登录记录",
            sort: 7,
            icon: "DefineIconLoginSVGIcon",
            component: () => import("../views/system/user/loginRecord.vue"),
          },
        ],
      },
      {
        path: contentPath + "/studentServer",
        name: "学员服务",
        icon: "DefineIconStudentServerSVGIcon",
        sort: 3,
        children: [
          {
            path: contentPath + "/studentManagement",
            name: "学员管理",
            icon: "DefineIconStudentManagementSVGIcon",
            sort: 1,
            component: () =>
              import("../views/oss/studentServer/student/index.vue"),
          },
          {
            path: contentPath + "/purchaseCourses",
            name: "购课管理",
            icon: "DefineIconStudentPurchaseCoursesSVGIcon",
            sort: 2,
            component: () =>
              import("../views/oss/studentServer/purchaseCourses/index.vue"),
          },
        ],
      },
      {
        path: contentPath + "/partnerManage",
        name: "合伙人管理",
        icon: "DefineIconPurchaseCoursesSVGIcon",
        sort: 3,
        children: [
          {
            path: contentPath + "/partnerShareManagement",
            name: "权益管理",
            icon: "DefineIconEquitiesManageSVGIcon",
            sort: 2,
            component: () =>
              import("../views/oss/studentServer/partnerShare/index.vue"),
          },
          {
            path: contentPath + "/dividendManagement",
            name: "分红管理",
            icon: "DefineIconDividendManageSVGIcon",
            sort: 2,
            component: () =>
              import("../views/oss/functionCenter/dividend/index.vue"),
          },
          {
            path: contentPath + "/rechargeManage",
            name: "充值管理",
            icon: "DefineIconTopupManagementSVGIcon",
            sort: 2,
            component: () =>
              import("../views/oss/functionCenter/rechargeManage/index.vue"),
          },
        ],
      },
      {
        path: contentPath + "/functionCenter",
        name: "功能中心",
        icon: "DefineIconFunctionCenterIconSVGIcon",
        sort: 4,
        children: [
          {
            path: contentPath + "/tradeManage",
            name: "练习管理",
            icon: "DefineIconTradeManageSVGIcon",
            sort: 1,
            component: () =>
              import("../views/oss/functionCenter/trade/index.vue"),
          },
          {
            path: contentPath + "/positionManage",
            name: "持仓管理",
            icon: "DefineIconPositionManageSVGIcon",
            sort: 2,
            component: () =>
              import("../views/oss/functionCenter/position/index.vue"),
          },
          {
            path: contentPath + "/capitalManage",
            name: "资金管理",
            icon: "DefineIconCapitalManageSVGIcon",
            sort: 3,
            component: () =>
              import("../views/oss/functionCenter/capital/index.vue"),
          },
          {
            path: contentPath + "/principalManage",
            name: "本金管理",
            icon: "DefineIconPrincipalManagementSVGIcon",
            sort: 4,
            component: () =>
              import("../views/oss/functionCenter/principal/index.vue"),
          },
          {
            path: contentPath + "/advice",
            name: "投资建议",
            icon: "DefineIconInvestmentAdviceSVGIcon",
            sort: 5,
            component: () =>
              import("../views/oss/functionCenter/advice/index.vue"),
          },
        ],
      },
      {
        path: contentPath + "/reportCenter",
        name: "报表中心",
        icon: "DefineIconFunctionCenterIconSVGIcon",
        sort: 4,
        children: [
          {
            path: contentPath + "/capitalSummary",
            name: "资金汇总",
            icon: "DefineIconCapitalSummarySVGIcon",
            sort: 1,
            component: () => import("../views/oss/report/capitalSummary.vue"),
          },
          {
            path: contentPath + "/positionSummary",
            name: "持仓汇总",
            icon: "DefineIconPositionSummarySVGIcon",
            sort: 2,
            component: () => import("../views/oss/report/positionSummary.vue"),
          },
          {
            path: contentPath + "/capitalSummaryOrgData",
            name: "资金汇总-原始数据",
            icon: "Grid",
            sort: 1,
            component: () => import("../views/oss/report/capitalSummaryOrgData.vue"),
          },
          {
            path: contentPath + "/positionSummaryOrgData",
            name: "持仓汇总-原始数据",
            icon: "Grid",
            sort: 2,
            component: () => import("../views/oss/report/positionSummaryOrgData.vue"),
          },
        ],
      },
      {
        path: contentPath + "/dataManage",
        name: "数据管理",
        icon: "DefineIconDataManageSVGIcon",
        sort: 4,
        children: [
          {
            path: contentPath + "/instrumentManage",
            name: "合约管理",
            icon: "DefineIconInstrumentManageSVGIcon",
            sort: 1,
            component: () =>
              import("../views/oss/dataManage/instrument/index.vue"),
          },
          {
            path: contentPath + "/lastPriceManage",
            name: "行情管理",
            icon: "DefineIconLastPriceSVGIcon",
            sort: 1,
            component: () =>
              import("../views/oss/dataManage/lastPrice/index.vue"),
          },
          {
            path: contentPath + "/importLog",
            name: "日报下载",
            icon: "DefineIconLastPriceSVGIcon",
            sort: 1,
            component: () =>
              import("../views/oss/dataManage/importLog/index.vue"),
          },
        ],
      },
    ],
  },
  // 不在框架中页面处理
  {
    path: contentPath + "/login",
    name: "登录页面",
    sort: 0,
    icon: "House",
    component: () => import("../views/system/Login.vue"),
    meta: { layout: "blank" },
  },
  {
    path: "/:pathMatch(.*)*",
    name: "404",
    component: () => import("../views/system/404.vue"),
  },
];

const router = createRouter({
  // createWebHistory(process.env.BASE_URL)
  mode: "history",
  base: contentPath,
  history: createWebHistory(),
  routes: routes,
});

export default router
